//
/***********************************************************
             File name:      main.c
             Author:         Bitat (陆叁柒)
             Email :         Bitat@qq.com
             Gitee :         https://gitee.com/bitat
             CSDN  :         https://blog.csdn.net/bitat 
             History:        2023/2/2
************************************************************/
    

//1 1 2 3 5 8 12
#include <stdio.h>

int Fib(int input)
{
    if(input == 1 || input == 2)
    {
        return 1;
    }
    else
    {
        int i = 0;
        int n1 = 1;
        int n2 = 1;
        int sum = 0;
        for(i = 3; i <= input; i++)
        {
            sum = n1 + n2;
            n1 = n2;
            n2 = sum;
        }
        return sum;
    }
}

int main()
{
    int input = 0;
    printf("请输入数字:>");
    scanf("%d",&input);
    printf("第%d个斐波纳列数是:>%d\n",input,Fib(input));
    
    return 0;
}
